#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>

#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
#include <mqueue.h>

#define FILE_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)

int main() {
	mqd_t id;
	struct mq_attr attr;

	id = mq_open("/my", O_RDWR|O_CREAT, FILE_MODE, NULL);
	if (id < 0) {
		printf("%s\n", strerror(errno));
		return 1;
	}

	mq_getattr(id, &attr);
	printf("max = %ld, size = %ld, cur = %ld\n", \
			attr.mq_maxmsg, attr.mq_msgsize, attr.mq_curmsgs);
	mq_close(id);

	return 0;
}
